load TagBlock,AttachData,ListBlock,References,SourceButtons

! BIRT, DEAT, MARR, or other events in a box
#eventTag=@contents

#tagKey=#eventTag&" details"
Title @this.altview&" - "&local(#tagKey)
cell GroupBox,local(#tagKey)
  width -1
  SetTab 130

  ! static text event date and place
  NewLine
  cell static,local("DATE")&":"
  set tabwidth 1 alignment right
  cell expression,@parent.DATE
  set Width -1 AppendedExpression view

  NewLine
  cell static,local("PLAC")&":"
  set tabwidth 1 alignment right
  cell expression,@parent.PLAC
  set Width -1

  if #eventTag="BIRT"
    Show ADDR
    ShowAll PHON
    ShowAll EMAIL
    ShowAll FAX
    ShowAll WWW
    ShowAll _GPS
    ShowAll TYPE
    ShowAll AGNC
    ShowAll RELI details
  else if #eventTag="DEAT"
    Show ADDR
    ShowAll PHON
    ShowAll EMAIL
    ShowAll FAX
    ShowAll WWW
    ShowAll _GPS
    Show AGE
    Show CAUS
    ShowAll TYPE
    ShowAll AGNC
    ShowAll RELI details
  else
    if @rec=INDI
      Show AGE
    endif
    Show TYPE
    ShowAll TYPE
    Show ADDR
    ShowAll PHON
    ShowAll EMAIL
    ShowAll FAX
    ShowAll WWW
    ShowAll _GPS
    ShowAll CAUS
    ShowAll AGNC
    ShowAll RELI details

    if @rec=FAM
      ShowAll HUSB
      ShowAll WIFE
    endif
  endif
  if RESN is Here
    Show RESN "menu"
  endif

  ! Show family links
  if #eventTag="ADOP"
    #attachFAMC=1
  else if #eventTag="CHR"
    #attachFAMC=1
  else if #eventTag="BIRT"
    #attachFAMC=1
  else
    #attachFAMC=0
  endif
  if #attachFAMC=1
    if FAMC is Here
      ShowAll FAMC #eventTag
      #attachFAMC=0
    endif
  endif
EndGroup

! --------- NOTEs, SOURs, and OBJEs -----------
gosub TagBlock,"OBJE",local("Multimedia")
#numSOURs=@count.SOUR
gosub References,"_LOG"

! --------- Attach links
newline
cell GroupBox,local("Attach")
  width -1
  newline -#lineSkip-3
  #lineSkip=0
  Show NOTE
  Show SOUR
  Show OBJE
  Show _LOG
  if #attachFAMC=1
    Show FAMC #eventTag
  endif
  GoSub AttachData
  GoSub SourceButtons,"true",#numSOURs
EndGroup
#lineSkip=#lineSkip$

optionaltag AGNC,local("AGNC"),local("AGNC")
optionaltag TYPE,local("TYPE"),local("TYPE")
if @rec=FAM
  if @this.WIFE.SEX="M"
    optionaltag HUSB,local("HUSB 1's Age"),"","AGE age"
    optionaltag WIFE,local("HUSB 2's Age"),"","AGE age"
  else if @this.HUSB.SEX="F"
    optionaltag HUSB,local("WIFE 1's Age"),"","AGE age"
    optionaltag WIFE,local("WIFE 2's Age"),"","AGE age"
  else
    optionaltag HUSB,local("HUSB's Age"),"","AGE age"
    optionaltag WIFE,local("WIFE's Age"),"","AGE age"
  endif
endif
optionaltag EMAIL,local("EMAIL"),""
optionaltag FAX,local("FAX"),""
optionaltag WWW,local("WWW"),""
optionaltag _GPS,local("_GPS"),""
optionalTag RESN,local("RESN"),""
optionalTag RELI,local("RELI"),""

resizewindow yes




